<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>无标题文本</title>
    <link th:href="@{/css/style.css}" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" th:src="@{/js/jquery.js}"></script>
    <script type="text/javascript">
        function tipOpen1(ele) {
            var cwid = $(ele).prev().val();
            $(".tipright p").text("确定此订单发货吗?");
            $("#tip").fadeIn(200);
            $("#cwid").val(cwid);
            $("#status").val(1);
        }

        function tipOpen2(ele) {
            var cwid = $(ele).prev().val();
            $(".tipright p").text("确定取消此订单吗?");
            $("#tip").fadeIn(200);
            $("#cwid").val(cwid);
            $("#status").val(2);
        }

        function tipOpen3(ele) {
            var cwid = $(ele).prev().val();
            $(".tipright p").text("确定回款吗?");
            $("#tip").fadeIn(200);
            $("#cwid").val(cwid);
            $("#status").val(3);
        }

        function tipOpen4(ele) {
            var cwid = $(ele).prev().val();
            $(".tipright p").text("确认已退货吗?");
            $("#tip").fadeIn(200);
            $("#cwid").val(cwid);
            $("#status").val(4);
        }

        function tipClose() {
            $("#tip").fadeOut(200);
        }

        function tipQueding() {
            $("#tip").fadeOut(200);
            var cwid = $("#cwid").val();
            var status=$("#status").val();
            window.location.href="/erp/ckWarehouse/editStatus?ckwid="+cwid+"&status="+status;
        }
    </script>
</head>

<body>
<div class="place"><span>位置：</span>
    <ul class="placeul">
        <li>仓库管理</li>
        <li>出库管理</li>
        <li>基本内容</li>
    </ul>
</div>
<div class="rightinfo">
    <form id="form" th:action="@{/ckWarehouse/lists}" method="get" name="conditionForm">
        <input type="hidden" name="pageno" th:value="${session.pb.pageNum}"/>
        <ul class="tools">
            <li>仓库名称:
                <input placeholder="请输入名称" type="text" name="cName" th:value="${cName}"/>
            </li>
            <li>订单编号:
                <input placeholder="请输入编号" type="text" name="indent" th:value="${indent}"/>
            </li>
            <li>状态:
                <select name="state">
                    <option value="">请选择</option>
                    <option value="1" th:selected="${state=='1'}">未发货</option>
                    <option value="2" th:selected="${state=='2'}">已发货</option>
                    <option value="3" th:selected="${state=='3'}">已回款</option>
                    <option value="4" th:selected="${state=='4'}">取消订单</option>
                    <option value="5" th:selected="${state=='5'}">已退货</option>
                </select>
            </li>
            <li class="subBut" onclick="tiaoZhuan(1)"><img th:src="@{/images/t06.png}"/>查询</li>
            <li class="subBut" onclick="window.location.href='/erp/storage/delivery/deliveryAdd.html'">
                <img th:src="@{/images/t01.png}"/>添加出库
            </li>
            <li class="subBut" onclick="qingkong()"><img th:src="@{/images/t03.png}"/>重置</li>
            <script>
                function qingkong() {
                    $("input[name=cName]").val("");
                    $("input[name=indent]").val("");
                    $("select[name=state]>option:eq(0)").prop("selected", true);
                }
            </script>
        </ul>
        <table class="tablelist">
            <thead>
            <tr>
                <th>序号</th>
                <th>订单编号</th>
                <th>金额</th>
                <th>仓库名称</th>
                <th>出库时间</th>
                <th>出库人</th>
                <th>状态</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="ck,var:${session.pb.list}">
                <td th:text="${(session.pb.pageNum-1)*session.pb.pageSize+var.count}">1</td>
                <td th:text="${ck.indent}">DJ201701270001</td>
                <td th:text="'￥'+${ck.order.ordermoney}">￥9,876,582</td>
                <td th:text="${ck.warehouse.cName}">南京21号仓库</td>
                <td th:text="${#dates.format(ck.cDate,'yyyy-MM-dd hh:mm:ss')}">2013-09-09 15:05:05</td>
                <td th:text="${ck.userId==null?'':ck.ckUsers.uname}">朱元璋</td>

                <td th:if="${ck.state=='1'}">未发货</td>
                <td th:if="${ck.state=='2'}">已发货</td>
                <td th:if="${ck.state=='3'}">已回款</td>
                <td th:if="${ck.state=='4'}">取消订单</td>
                <td th:if="${ck.state=='5'}">已退货</td>
                <td>
                    <a th:href="@{'/market/order/outWarehouseBy?orderid='+${ck.indent}}" class="tablelink">查看详情</a>
                    <input type="hidden" th:value="${ck.id}"/>
                    <a th:if="${ck.state=='1'}" href="javascript:void(0)" class="tablelink"
                       onclick="tipOpen1(this)">发货</a>
                    <input type="hidden" th:value="${ck.id}"/>
                    <a th:if="${ck.state=='1' || ck.state=='2' || ck.state=='3' }" href="javascript:void(0)"
                       class="tablelink" onclick="tipOpen2(this)">取消订单</a>
                    <input type="hidden" th:value="${ck.id}"/>
                    <a th:if="${ck.state=='2'}" href="javascript:void(0)" class="tablelink" onclick="tipOpen3(this)">确认回款</a>
                    <input type="hidden" th:value="${ck.id}"/>
                    <a th:if="${ck.state=='4'}" href="javascript:void(0)" class="tablelink" onclick="tipOpen4(this)">确认已退货</a>
                </td>
            </tr>
            </tbody>
        </table>
        <div class="pagin">
            <div class="message">共<i class="blue" th:text="${pb.total}">1256</i>条记录，当前显示第&nbsp;<i class="blue"
                                                                                                  th:text="${pb.pageNum}">2&nbsp;</i>页
            </div>
            <ul class="paginList">
                <li class="paginItem">
                    <a href="javascript:void(0);" th:onclick="tiaoZhuan([[${pb.isFirstPage?1:pb.pageNum-1}]])">
                        <span th:class="${pb.isFirstPage?'pagepre':'pagenxt roate'}"></span>
                    </a>
                </li>

                <li class="paginItem" th:if="${1+4<=pb.pageNum}"><a th:onclick="tiaoZhuan(1)"
                                                                    href="javascript:void(0);">1</a></li>
                <li class="paginItem more" th:if="${1+5<=pb.pageNum}"><a href="javascript:void(0);">...</a></li>
                <li class="paginItem" th:if="${1+3<=pb.pageNum}"><a th:onclick="tiaoZhuan([[${pb.pageNum-3}]])"
                                                                    href="javascript:void(0);"
                                                                    th:text="${pb.pageNum-3}">3</a></li>
                <li class="paginItem" th:if="${1+2<=pb.pageNum}"><a th:onclick="tiaoZhuan([[${pb.pageNum-2}]])"
                                                                    href="javascript:void(0);"
                                                                    th:text="${pb.pageNum-2}">4</a></li>
                <li class="paginItem" th:if="${1+1<=pb.pageNum}"><a th:onclick="tiaoZhuan([[${pb.pageNum-1}]])"
                                                                    href="javascript:void(0);"
                                                                    th:text="${pb.pageNum-1}">1</a></li>

                <li class="paginItem current"><a href="javascript:void(0);" th:text="${pb.pageNum}">2</a></li>

                <li class="paginItem" th:if="${pb.pages-1>=pb.pageNum}"><a th:onclick="tiaoZhuan([[${pb.pageNum+1}]])"
                                                                           href="javascript:void(0);"
                                                                           th:text="${pb.pageNum+1}">3</a></li>
                <li class="paginItem" th:if="${pb.pages-2>=pb.pageNum}"><a th:onclick="tiaoZhuan([[${pb.pageNum+2}]])"
                                                                           href="javascript:void(0);"
                                                                           th:text="${pb.pageNum+2}">4</a></li>
                <li class="paginItem" th:if="${pb.pages-3>=pb.pageNum}"><a th:onclick="tiaoZhuan([[${pb.pageNum+3}]])"
                                                                           href="javascript:void(0);"
                                                                           th:text="${pb.pageNum+3}">5</a></li>
                <li class="paginItem more" th:if="${pb.pages-5>=pb.pageNum}"><a href="javascript:void(0);">...</a></li>
                <li class="paginItem" th:if="${pb.pages-4>=pb.pageNum}"><a th:onclick="tiaoZhuan([[${pb.pages}]])"
                                                                           href="javascript:void(0);"
                                                                           th:text="${pb.pages}">10</a></li>

                <li class="paginItem">
                    <a href="javascript:void(0);" th:onclick="tiaoZhuan([[${pb.isLastPage?pb.pages:pb.pageNum+1}]])">
                        <span th:class="${pb.isLastPage?'pagepre roate ':'pagenxt '}"></span>
                    </a>
                </li>
            </ul>
        </div>
    </form>
    <script>
        // 页面跳转
        function tiaoZhuan(num) {
            $("input[name=pageno]").val(num);
            $("#form").submit();
        }
    </script>
    <!-- 提示框 -->
    <div id="tip" class="tip">
        <div class="tiptop"><span>提示信息</span><a onclick="tipClose()"></a></div>
        <div class="tipinfo"><span><img th:src="@{/images/ticon.png}"/></span>
            <div class="tipright">
                <p></p>
                <cite>如果是请点击确定按钮 ，否则请点取消。</cite></div>
        </div>
        <div class="tipbtn">
            <input type="hidden" id="cwid"/>
            <input type="hidden" id="status"/>
            <input name="" type="button" class="sure" value="确定" onclick="tipQueding()"/>
            &nbsp;
            <input name="" type="button" class="cancel" value="取消" onclick="tipClose()"/>
        </div>
    </div>
</div>
<script type="text/javascript">
    $('.tablelist tbody tr:odd').addClass('odd');
</script>
</body>
</html>
